<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" />
<xsl:template match="/">
<xsl:apply-templates select="/area" />
<xsl:apply-templates select="/area/helps" />
<xsl:apply-templates select="/area/mobs" />
<xsl:apply-templates select="/area/mobProgs" />
<xsl:apply-templates select="/area/items" />
<xsl:apply-templates select="/area/rooms" />
<xsl:apply-templates select="/area/resets" />
<xsl:apply-templates select="/area/shops" />
<xsl:apply-templates select="/area/specials" />
#$
</xsl:template>
<xsl:template match="/area">#AREA
<xsl:value-of select="file" />~
<xsl:value-of select="title" />~
<xsl:value-of select="minLevel" /><xsl:text> </xsl:text><xsl:value-of select="maxLevel" /><xsl:text> </xsl:text><xsl:value-of select="author" />~
<xsl:value-of select="minVnum" /><xsl:text> </xsl:text><xsl:value-of select="maxVnum" /> 0
</xsl:template>

<xsl:template match="/area/helps">
#HELPS<xsl:apply-templates select="/area/helps/help" /><xsl:text>
</xsl:text>0 $~
</xsl:template>

<xsl:template match="/area/mobs">
#MOBILES<xsl:apply-templates select="/area/mobs/mob" />
#0
</xsl:template>

<xsl:template match="/area/mobProgs">
#MOBPROGS<xsl:apply-templates select="/area/mobProgs/prog" />
#0
</xsl:template>

<xsl:template match="/area/items">
#OBJECTS<xsl:apply-templates select="/area/items/item" />
#0
</xsl:template>

<xsl:template match="/area/rooms">
#ROOMS<xsl:apply-templates select="/area/rooms/room" />
#0
</xsl:template>

<xsl:template match="/area/resets">
#RESETS
<xsl:apply-templates select="/area/resets/reset" />
S
</xsl:template>

<xsl:template match="/area/shops">
#SHOPS
<xsl:apply-templates select="/area/shops/shop" />
0
</xsl:template>

<xsl:template match="/area/specials">
#SPECIALS
<xsl:apply-templates select="/area/specials/special" />
S
</xsl:template>

<!-- Specifics -->

<!-- HELPS -->
<xsl:template match="/area/helps/help"><xsl:text>
</xsl:text><xsl:value-of select="@minLevel" /><xsl:text> </xsl:text><xsl:value-of select="@keywords" />~
<xsl:value-of select="description" />
~
</xsl:template>

<!-- MOBS -->

<xsl:template match="/area/mobs/mob">
#<xsl:value-of select="@vnum" /><xsl:text>
</xsl:text><xsl:value-of select="keywords" />~
<xsl:value-of select="name" />~
<xsl:value-of select="short" />
~
<xsl:value-of select="long" />
~
<xsl:value-of select="race" />~
<xsl:value-of select="action" /><xsl:text> </xsl:text><xsl:value-of select="affects" /><xsl:text> </xsl:text><xsl:value-of select="moreAffects" /><xsl:text> </xsl:text><xsl:value-of select="alignment" /><xsl:text> </xsl:text><xsl:value-of select="mobGroup" /><xsl:text>
</xsl:text><xsl:value-of select="level" /><xsl:text> </xsl:text><xsl:value-of select="class" /><xsl:text> </xsl:text><xsl:value-of select="castLevel" /><xsl:text> </xsl:text><xsl:value-of select="hitDice" /><xsl:text> </xsl:text><xsl:value-of select="manaDice" /><xsl:text> </xsl:text><xsl:value-of select="damBonus" /><xsl:text> </xsl:text><xsl:value-of select="damDice" /><xsl:text> </xsl:text><xsl:value-of select="damType" /><xsl:text>
</xsl:text><xsl:value-of select="pierce" /><xsl:text> </xsl:text><xsl:value-of select="bash" /><xsl:text> </xsl:text><xsl:value-of select="slash" /><xsl:text> </xsl:text><xsl:value-of select="magical" /><xsl:text>
</xsl:text><xsl:value-of select="offensiveFlags" /><xsl:text> </xsl:text><xsl:value-of select="immuneFlags" /><xsl:text> </xsl:text><xsl:value-of select="resistFlags" /><xsl:text> </xsl:text><xsl:value-of select="vulnFlags" /><xsl:text>
</xsl:text><xsl:value-of select="startPos" /><xsl:text> </xsl:text><xsl:value-of select="defaultPos" /><xsl:text> </xsl:text><xsl:value-of select="sex" /><xsl:text> </xsl:text><xsl:value-of select="treasure" /><xsl:choose><xsl:when test="formFlags != ''"><xsl:text>
</xsl:text><xsl:value-of select="formFlags" /><xsl:text> </xsl:text><xsl:value-of select="partFlags" /><xsl:text> </xsl:text><xsl:value-of select="size" /><xsl:text> </xsl:text><xsl:value-of select="materialType" /></xsl:when></xsl:choose><xsl:choose><xsl:when test="clan != ''"><xsl:text>
</xsl:text>C <xsl:value-of select="clan" /></xsl:when></xsl:choose>
<xsl:apply-templates select="mobFlags/flag" /><xsl:apply-templates select="mobProgs/prog" /><xsl:text>
</xsl:text></xsl:template>

<xsl:template match="/area/mobs/mob/mobProgs/prog"><xsl:text>
</xsl:text>M <xsl:value-of select="@type" /><xsl:text> </xsl:text><xsl:value-of select="prog" /><xsl:text> </xsl:text><xsl:value-of select="argument" />~</xsl:template>

<xsl:template match="/area/mobs/mob/mobFlags/flag"><xsl:text>
</xsl:text>F <xsl:value-of select="@type" /><xsl:text> </xsl:text><xsl:value-of select="value" /></xsl:template>

<!-- MOBPROGS -->

<xsl:template match="/area/mobProgs/prog">
#<xsl:value-of select="@vnum" /><xsl:text>
</xsl:text><xsl:value-of select="program" />~
</xsl:template>

<!-- ITEMS -->

<xsl:template match="/area/items/item">
#<xsl:value-of select="@vnum" /><xsl:text>
</xsl:text><xsl:value-of select="keywords" />~
<xsl:value-of select="name" />~
<xsl:value-of select="description" />~
<xsl:value-of select="material" />~
<xsl:value-of select="itemType" /><xsl:text> </xsl:text><xsl:value-of select="extraFlags" /><xsl:text> </xsl:text><xsl:value-of select="wearFlags" /><xsl:text>
</xsl:text><xsl:value-of select="V0" /><xsl:text> </xsl:text><xsl:value-of select="V1" /><xsl:text> </xsl:text><xsl:value-of select="V2" /><xsl:text> </xsl:text><xsl:value-of select="V3" /><xsl:text> </xsl:text><xsl:value-of select="V4" /><xsl:choose><xsl:when test="V5 != '0'"><xsl:text> </xsl:text><xsl:value-of select="V5" /></xsl:when></xsl:choose><xsl:text>
</xsl:text><xsl:value-of select="level" /><xsl:text> </xsl:text><xsl:value-of select="minSize" /><xsl:text> </xsl:text><xsl:value-of select="maxSize" /><xsl:text> </xsl:text><xsl:value-of select="weight" /><xsl:text> </xsl:text><xsl:value-of select="cost" /> P<xsl:apply-templates select="trapTrigger" /><xsl:apply-templates select="triggers/trigger" /><xsl:apply-templates select="affects/affect" />
<xsl:apply-templates select="flags/flag" /><xsl:apply-templates select="extraKeywords" /><xsl:text>
</xsl:text></xsl:template>

<xsl:template match="/area/items/item/trapTrigger"><xsl:text>
</xsl:text><xsl:value-of select="../trapLevel" /><xsl:text> </xsl:text><xsl:value-of select="../trapTrigger" /><xsl:text> </xsl:text><xsl:value-of select="../trapDamage" /><xsl:text> </xsl:text><xsl:value-of select="../trapCharges" /><xsl:text> </xsl:text>
</xsl:template>

<xsl:template match="/area/items/item/triggers/trigger">
S
<xsl:value-of select="@type" /><xsl:text> </xsl:text><xsl:value-of select="chance" /> -<xsl:value-of select="count" /><xsl:text> </xsl:text><xsl:value-of select="spell" />~
</xsl:template>

<xsl:template match="/area/items/item/affects/affect">
A
<xsl:value-of select="@type" /><xsl:text> </xsl:text><xsl:value-of select="value" />
</xsl:template>

<xsl:template match="/area/items/item/flags/flag">
F
<xsl:value-of select="@type" /><xsl:text> </xsl:text><xsl:value-of select="@location" /><xsl:text> </xsl:text><xsl:value-of select="value" /><xsl:text> </xsl:text><xsl:value-of select="bits" /></xsl:template>

<xsl:template match="/area/items/item/extraKeywords">
<xsl:choose><xsl:when test="../extraKeywords != ''"><xsl:text>
</xsl:text>E
<xsl:value-of select="../extraKeywords" />~
<xsl:value-of select="../extraDescription" />
~</xsl:when></xsl:choose></xsl:template>

<!-- ROOMS -->

<xsl:template match="/area/rooms/room">
#<xsl:value-of select="@vnum" /><xsl:text>
</xsl:text><xsl:value-of select="title" />~
<xsl:value-of select="description" />
~
<xsl:value-of select="xxValue" /><xsl:text> </xsl:text><xsl:value-of select="roomFlags" /><xsl:text> </xsl:text><xsl:value-of select="sectorFlags" />
M <xsl:value-of select="manaRegen" /> H <xsl:value-of select="hpRegen" /><xsl:apply-templates select="exits/exit" /><xsl:apply-templates select="extras/extra" />
S
</xsl:template>

<xsl:template match="/area/rooms/room/exits/exit">
<xsl:text>
</xsl:text>D<xsl:value-of select="@direction" /><xsl:text>
</xsl:text><xsl:value-of select="description" />
~
<xsl:value-of select="keyphrase" />~
<xsl:value-of select="doorState" /><xsl:text> </xsl:text><xsl:value-of select="keyVNum" /><xsl:text> </xsl:text><xsl:value-of select="linkVNum" />
</xsl:template>

<xsl:template match="/area/rooms/room/extras/extra">
E
<xsl:value-of select="@keyword" />~
<xsl:value-of select="@description" />
~</xsl:template>

<!-- RESETS -->

<xsl:template match="/area/resets/reset"><xsl:variable name="vnum"><xsl:value-of select="vnum" /></xsl:variable><xsl:variable name="vnum2"><xsl:value-of select="vnumWearDoor" /></xsl:variable>
<xsl:value-of select="@type" /><xsl:text>	</xsl:text><xsl:value-of select="slot" /><xsl:text>	</xsl:text><xsl:value-of select="vnum" /><xsl:text>	</xsl:text><xsl:choose><xsl:when test="string-length(vnum) &lt;= 3"><xsl:text>	</xsl:text></xsl:when></xsl:choose><xsl:value-of select="limit" /><xsl:text>	</xsl:text><xsl:value-of select="vnumWearDoor" /><xsl:text>	</xsl:text><xsl:value-of select="extraParam" /><xsl:choose>
<xsl:when test="@type = 'M'">		* <xsl:value-of select="/area/mobs/mob[@vnum = $vnum]/name" /></xsl:when>
<xsl:when test="@type = 'E'">			* <xsl:text>  </xsl:text><xsl:choose><xsl:when test="/area/items/item[@vnum = $vnum]/name != ''"><xsl:value-of select="/area/items/item[@vnum = $vnum]/name" /></xsl:when><xsl:otherwise> - item not in area - </xsl:otherwise></xsl:choose></xsl:when>
<xsl:when test="@type = 'G'">			* <xsl:text>  </xsl:text><xsl:choose><xsl:when test="/area/items/item[@vnum = $vnum]/name != ''"><xsl:value-of select="/area/items/item[@vnum = $vnum]/name" /></xsl:when><xsl:otherwise> - item not in area - </xsl:otherwise></xsl:choose></xsl:when>
<xsl:when test="@type = 'P'">			* <xsl:text>  </xsl:text><xsl:choose><xsl:when test="/area/items/item[@vnum = $vnum]/name != ''"><xsl:value-of select="/area/items/item[@vnum = $vnum]/name" /></xsl:when><xsl:otherwise> - item not in area - </xsl:otherwise></xsl:choose> -> <xsl:choose><xsl:when test="/area/items/item[@vnum = $vnum2]/name != ''"><xsl:value-of select="/area/items/item[@vnum = $vnum2]/name" /></xsl:when><xsl:otherwise> - item not in area - </xsl:otherwise></xsl:choose></xsl:when>
<xsl:when test="@type = 'O'">		* <xsl:choose><xsl:when test="/area/items/item[@vnum = $vnum]/name != ''"><xsl:value-of select="/area/items/item[@vnum = $vnum]/name" /></xsl:when><xsl:otherwise> - item not in area - </xsl:otherwise></xsl:choose> -> <xsl:choose><xsl:when test="/area/rooms/room[@vnum = $vnum2]/title != ''"><xsl:value-of select="/area/rooms/room[@vnum = $vnum2]/title" /></xsl:when><xsl:otherwise> - room not in area - </xsl:otherwise></xsl:choose></xsl:when>
<xsl:when test="@type = 'D'">			* <xsl:value-of select="/area/rooms/room[@vnum = $vnum]/title" /> (<xsl:choose>
<xsl:when test="limit = '0'">north</xsl:when> 
<xsl:when test="limit = '1'">east</xsl:when>
<xsl:when test="limit = '2'">south</xsl:when>
<xsl:when test="limit = '3'">west</xsl:when>
<xsl:when test="limit = '4'">up</xsl:when>
<xsl:when test="limit = '5'">down</xsl:when>
</xsl:choose>)</xsl:when>

</xsl:choose><xsl:text>
</xsl:text>
</xsl:template>

<!-- SHOPS -->

<xsl:template match="/area/shops/shop"><xsl:variable name="vnum"><xsl:value-of select="@vnum" /></xsl:variable><xsl:text>
</xsl:text><xsl:value-of select="@vnum" /><xsl:text>	</xsl:text>
<xsl:value-of select="@first" /><xsl:text>	</xsl:text>
<xsl:value-of select="@second" /><xsl:text>	</xsl:text>
<xsl:value-of select="@third" /><xsl:text>	</xsl:text>
<xsl:value-of select="@fourth" /><xsl:text>	</xsl:text>
<xsl:value-of select="@fifth" /><xsl:text>	</xsl:text>
<xsl:value-of select="@profitBuy" /><xsl:text>	</xsl:text>
<xsl:value-of select="@profitSell" /><xsl:text>	</xsl:text>
<xsl:value-of select="@startHour" /><xsl:text>	</xsl:text>
<xsl:value-of select="@endHour" /><xsl:text>	* </xsl:text>
<xsl:value-of select="/area/mobs/mob[@vnum = $vnum]/name" />
</xsl:template>

<!-- SPECIALS -->

<xsl:template match="/area/specials/special">
<xsl:variable name="vnum"><xsl:value-of select="@vnum" /></xsl:variable>
<xsl:variable name="text">M	<xsl:value-of select="@vnum" /><xsl:text>	</xsl:text><xsl:value-of select="@type" /></xsl:variable>
<xsl:value-of select="$text" /><xsl:choose>
<xsl:when test="string-length($text) = 20"><xsl:text>		</xsl:text></xsl:when>
<xsl:when test="string-length($text) &lt; 20"><xsl:text>			</xsl:text></xsl:when>
<xsl:when test="string-length($text) &gt; 21 and string-length($text) &lt;= 25"><xsl:text>		</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>	</xsl:text></xsl:otherwise>
</xsl:choose>	* <xsl:value-of select="/area/mobs/mob[@vnum = $vnum]/name" /><xsl:text>
</xsl:text>
</xsl:template>

</xsl:stylesheet>